```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>代理设计模式：控制访问的精妙工具</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1a202c;
            line-height: 1.6;
        }
        .noto-serif {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6b46c1 0%, #4299e1 100%);
        }
        .code-block {
            background-color: #2d3748;
            border-radius: 0.5rem;
            color: #e2e8f0;
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .mermaid svg {
            margin: 0 auto;
            display: block;
        }
    </style>
</head>
<body class="min-h-screen">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6 noto-serif leading-tight">
                代理设计模式：<span class="text-yellow-300">控制访问的精妙工具</span>
            </h1>
            <p class="text-xl md:text-2xl opacity-90 mb-10 max-w-3xl mx-auto">
                在不改变原始类接口的情况下，引入控制层来管理访问权限、实现延迟加载等额外功能
            </p>
            <div class="flex justify-center space-x-4">
                <a href="#concept" class="px-6 py-3 bg-white text-indigo-700 font-semibold rounded-full hover:bg-gray-100 transition duration-300">
                    <i class="fas fa-lightbulb mr-2"></i>核心概念
                </a>
                <a href="#implementation" class="px-6 py-3 border-2 border-white text-white font-semibold rounded-full hover:bg-white hover:text-indigo-700 transition duration-300">
                    <i class="fas fa-code mr-2"></i>代码实现
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-6xl px-4 py-12">
        <!-- Intro Section -->
        <section class="mb-16">
            <p class="text-xl text-gray-700 leading-relaxed mb-8">
                代理设计模式是一种常见的结构型设计模式，它在不改变原始类接口的情况下，引入了一个新的类来控制对原始类的访问。代理模式可以用于增加额外的逻辑，例如权限校验、延迟加载等，而无需修改原始类代码。
            </p>
            
            <!-- Features Cards -->
            <div id="concept" class="grid md:grid-cols-2 gap-6 mb-16">
                <div class="bg-white rounded-xl shadow-md p-6 card-hover border-l-4 border-indigo-500">
                    <div class="flex items-center mb-4">
                        <div class="bg-indigo-100 p-3 rounded-full mr-4">
                            <i class="fas fa-shield-alt text-indigo-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">控制访问</h3>
                    </div>
                    <p class="text-gray-600">
                        代理模式可以控制客户端对目标对象的访问，可以加入额外的逻辑来控制对目标对象的访问权限。
                    </p>
                </div>
                
                <div class="bg-white rounded-xl shadow-md p-6 card-hover border-l-4 border-blue-500">
                    <div class="flex items-center mb-4">
                        <div class="bg-blue-100 p-3 rounded-full mr-4">
                            <i class="fas fa-code-branch text-blue-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">保持接口一致性</h3>
                    </div>
                    <p class="text-gray-600">
                        代理模式与原始类实现相同的接口，客户端无需知道代理对象的存在，可以透明地使用。
                    </p>
                </div>
            </div>

            <!-- Mermaid Diagram -->
            <div class="bg-white rounded-xl shadow-md p-6 mb-16">
                <h2 class="text-2xl font-bold text-gray-800 mb-6 noto-serif border-b pb-2">代理模式结构图</h2>
                <div class="mermaid">
                    classDiagram
                    class Client
                    class Subject {
                        <<interface>>
                        +request()
                    }
                    class RealSubject {
                        +request()
                    }
                    class Proxy {
                        -realSubject: RealSubject
                        +request()
                    }
                    
                    Client --> Subject
                    Subject <|-- RealSubject
                    Subject <|-- Proxy
                    Proxy --> RealSubject
                </div>
            </div>
        </section>

        <!-- Use Cases Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold text-gray-800 mb-8 noto-serif">适用场景</h2>
            
            <div class="grid md:grid-cols-2 lg:grid-cols-4 gap-6">
                <div class="bg-gradient-to-br from-purple-50 to-blue-50 rounded-xl p-6 card-hover">
                    <div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mb-4">
                        <i class="fas fa-network-wired text-purple-600 text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-gray-800 mb-2">远程代理</h3>
                    <p class="text-gray-600 text-sm">
                        当一个对象位于不同的地址空间，需要通过网络访问时，可以使用远程代理来隐藏实现细节。
                    </p>
                </div>
                
                <div class="bg-gradient-to-br from-indigo-50 to-blue-50 rounded-xl p-6 card-hover">
                    <div class="w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center mb-4">
                        <i class="fas fa-clock text-indigo-600 text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-gray-800 mb-2">虚拟代理</h3>
                    <p class="text-gray-600 text-sm">
                        当对象创建代价较大时，可以使用虚拟代理来推迟对象的创建，提升性能。
                    </p>
                </div>
                
                <div class="bg-gradient-to-br from-blue-50 to-cyan-50 rounded-xl p-6 card-hover">
                    <div class="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center mb-4">
                        <i class="fas fa-lock text-blue-600 text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-gray-800 mb-2">安全代理</h3>
                    <p class="text-gray-600 text-sm">
                        在控制对原始对象的访问时，可以使用安全代理来实现权限校验等功能。
                    </p>
                </div>
                
                <div class="bg-gradient-to-br from-green-50 to-teal-50 rounded-xl p-6 card-hover">
                    <div class="w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center mb-4">
                        <i class="fas fa-hourglass-start text-green-600 text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-gray-800 mb-2">延迟加载</h3>
                    <p class="text-gray-600 text-sm">
                        当需要的时候再加载对象，可以使用延迟加载代理来提升性能。
                    </p>
                </div>
            </div>
        </section>

        <!-- Framework Applications -->
        <section class="mb-16 bg-gray-50 rounded-xl p-8">
            <h2 class="text-3xl font-bold text-gray-800 mb-8 noto-serif">框架中的应用</h2>
            
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-white rounded-lg shadow-sm p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-spring-100 p-2 rounded mr-4">
                            <i class="fab fa-java text-green-500 text-2xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">Spring AOP</h3>
                    </div>
                    <p class="text-gray-600">
                        Spring框架中的AOP功能实际上就是一种代理模式的应用，它允许在方法执行前后插入额外逻辑，实现事务管理、日志记录等功能。
                    </p>
                </div>
                
                <div class="bg-white rounded-lg shadow-sm p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-blue-100 p-2 rounded mr-4">
                            <i class="fas fa-database text-blue-500 text-2xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">Hibernate</h3>
                    </div>
                    <p class="text-gray-600">
                        Hibernate框架中的懒加载就是通过代理模式实现的，延迟加载提升了查询性能。
                    </p>
                </div>
                
                <div class="bg-white rounded-lg shadow-sm p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-red-100 p-2 rounded mr-4">
                            <i class="fas fa-bolt text-red-500 text-2xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">Java动态代理</h3>
                    </div>
                    <p class="text-gray-600">
                        Java提供了动态代理机制，通过Proxy类和InvocationHandler接口，可以动态生成代理类。
                    </p>
                </div>
            </div>
        </section>

        <!-- Implementation Section -->
        <section id="implementation" class="mb-16">
            <h2 class="text-3xl font-bold text-gray-800 mb-8 noto-serif">实现方式</h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <!-- Static Proxy -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-indigo-600 text-white px-6 py-4">
                        <h3 class="text-xl font-bold flex items-center">
                            <i class="fas fa-file-code mr-3"></i>
                            静态代理
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-600 mb-4">
                            手动编写代理类，实现原始类接口，同时在代理类中调用原始类方法，并可以增加额外逻辑。
                        </p>
                        <div class="code-block p-4 rounded-lg overflow-auto text-sm">
                            <pre><code class="language-java">// 接口
interface Image {
    void display();
}

// 原始类
class RealImage implements Image {
    private String filename;

    public RealImage(String filename) {
        this.filename = filename;
        loadFromDisk();
    }

    private void loadFromDisk() {
        System.out.println("Loading " + filename);
    }

    public void display() {
        System.out.println("Displaying " + filename);
    }
}

// 代理类
class ProxyImage implements Image {
    private RealImage realImage;
    private String filename;

    public ProxyImage(String filename) {
        this.filename = filename;
    }

    public void display() {
        if (realImage == null) {
            realImage = new RealImage(filename);
        }
        realImage.display();
    }
}</code></pre>
                        </div>
                    </div>
                </div>
                
                <!-- Dynamic Proxy -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-blue-600 text-white px-6 py-4">
                        <h3 class="text-xl font-bold flex items-center">
                            <i class="fas fa-bolt mr-3"></i>
                            动态代理
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-600 mb-4">
                            使用Java提供的动态代理机制，通过Proxy类动态生成代理对象，无需手动编写代理类。
                        </p>
                        <div class="code-block p-4 rounded-lg overflow-auto text-sm">
                            <pre><code class="language-java">import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

interface Image {
    void display();
}

class RealImage implements Image {
    private String filename;

    public RealImage(String filename) {
        this.filename = filename;
        loadFromDisk();
    }

    private void loadFromDisk() {
        System.out.println("Loading " + filename);
    }

    public void display() {
        System.out.println("Displaying " + filename);
    }
}

class DynamicProxy implements InvocationHandler {
    private Object target;

    public DynamicProxy(Object target) {
        this.target = target;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("Before method call");
        Object result = method.invoke(target, args);
        System.out.println("After method call");
        return result;
    }
}

public class ProxyExample {
    public static void main(String[] args) {
        Image realImage = new RealImage("image.jpg");
        Image proxyImage = (Image) Proxy.newProxyInstance(
            ProxyExample.class.getClassLoader(),
            new Class[] { Image.class },
            new DynamicProxy(realImage)
        );

        proxyImage.display();
    }
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Summary Section -->
        <section class="bg-indigo-50 rounded-xl p-8 mb-16">
            <div class="flex items-start">
                <div class="bg-indigo-100 p-3 rounded-full mr-6">
                    <i class="fas fa-check-circle text-indigo-600 text-2xl"></i>
                </div>
                <div>
                    <h2 class="text-2xl font-bold text-gray-800 mb-4 noto-serif">模式优势总结</h2>
                    <p class="text-gray-700 mb-4">
                        通过代理设计模式，我们可以将额外的逻辑与原始类分离，实现更好的模块化和可维护性。无论是静态代理还是动态代理，代理模式都为代码的扩展和维护提供了便捷的解决方案。
                    </p>
                    <ul class="list-disc pl-5 text-gray-700 space-y-2">
                        <li>实现职责分离，降低系统耦合度</li>
                        <li>扩展目标对象功能更加灵活</li>
                        <li>作为中介保护目标对象，增强安全性</li>
                        <li>提高系统可扩展性和可维护性</li>
                    </ul>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8">
        <div class="container mx-auto px-4 text-center">
            <div class="mb-4">
                <p class="text-lg font-medium">技术小馆</p>
                <a href="http://www.yuque.com/jtostring" class="text-blue-400 hover:text-blue-300 transition duration-300 inline-block mt-2">
                    http://www.yuque.com/jtostring
                </a>
            </div>
            <div class="text-sm text-gray-500">
                &copy; 2023 技术小馆. All rights reserved.
            </div>
        </div>
    </footer>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            mermaid.initialize({
                startOnLoad: true,
                theme: 'default',
                fontFamily: "'Noto Sans SC', sans-serif"
            });
            
            // Smooth scrolling for anchor links
            document.querySelectorAll('a[href^="#"]').forEach(anchor => {
                anchor.addEventListener('click', function(e) {
                    e.preventDefault();
                    document.querySelector(this.getAttribute('href')).scrollIntoView({
                        behavior: 'smooth'
                    });
                });
            });
        });
    </script>
</body>
</html>
```